<?php
//@dynamic page interaction
if(isset($appHtml))
{
  if(!isset($appHtml))
  {
      $html->initHelper('AppHtml');
      $appHtml = $html->AppHtml;
  }
  if(cr("DynamicPage.field"))
  {
      $locationCrumb = array('url'=>"/",'title'=>cri("DynamicPage")->getPageTitle(cr("DynamicPage.field"),cr("DynamicPage.value")));
      array_unshift($breadCrumbElements ,$locationCrumb);
  }
  $currentAction = GigaActionHandler::getCurrentAction();
  if(($currentAction['action_id'] == "categorypages" && count($categoryPaths) > 1) || (isset($showCategoryCrumb) && $showCategoryCrumb == true))
  {
      unset($breadCrumbElements['categoy_view']);
      $categoryPaths = array_reverse($categoryPaths);
      foreach($categoryPaths as $categoryElem)
      {
          $crumb = array('url'=>$categoryElem['ListCategory']['viewUrl'],'title'=>$categoryElem['ListCategory']['name']);
          //$breadCrumbElements[] = $crumb;
          array_unshift($breadCrumbElements ,$crumb);
      }
  }
  $totalCount = count($breadCrumbElements);
  $i=1;?>
  <?php if($totalCount > 0)
  {?>
      <ul class="breadcrumb">
          <li>

              <?php 
                  $homeUrl = "/";
                  if(isset($this->params['admin']))
                  {
                      $homeUrl = "/admin";
                  }
                  //echo $html->link($html->image("/img/home.png",array('class'=>"home",'alt'=>"Home")),$homeUrl,array('title'=>"Home",'escape'=>false));
                  echo $html->link(__("Home"),$homeUrl,array('title'=>"Home",'escape'=>false));
                  ?>
          </li>
      <?php foreach($breadCrumbElements as $element)
          {
              if(is_array($element['url']))
              {
                  $url = $breadCrumb->getUrlFromUrlIfo($element);
              }else{
                  $url = $element['url'];
              }//$element['url'];
              $title = $element['title'];
              ?>
      <li class="breadcrum-children"><?php echo $appHtml->link(__($title),$url,array('title'=>$title))?> <?php if($i < $totalCount){?>
      <span class="clear"></span>  <span class="clear"></span> <?php }?></li>
      <?php
      $i++;
          }?>
  </ul>
          <?php }?>
<?php } ?>